<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function fun1(value){
            console.log("改变文字的值是："+value);
            console.log("改变文字")
        } 
        function fun2(){
            console.log("失去焦点")
        }
        function fun3(){
            console.log("聚集焦点")
        }function fun4(){
            console.log("选中")
        }
        function sumbit(){
            
            // if(!flag){
            //     return false; // 阻止表单提交
            // }
            // return true; // 允许表单提交
            var flag = confirm("确定提交吗？");
            if(!flag){
                event.preventDefault(); // 阻止表单提交
            }
        }

    </script>
</head>
<body>
    <form action="./1.js引入.html" method="get" onsubmit="return sumbit()">
        <input type="text" name="name" value="张三" onchange="fun1(this.value)" onblur="fun2()" onfocus="fun3()">
        <input type="text" name="age" value="18">
        <input type="submit" value="提交">
        <input type="reset" value="重置">
        <!-- <input type="search"> -->
         <input type="text" name="" id="" onselect="fun4()">
    </form>
</body>
</html>